/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author freis
 */
@Entity
@Table(name = "sessoes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Sessoes.findAll", query = "SELECT s FROM Sessoes s"),
    @NamedQuery(name = "Sessoes.findByIdSessoes", query = "SELECT s FROM Sessoes s WHERE s.idSessoes = :idSessoes"),
    @NamedQuery(name = "Sessoes.findByEstado", query = "SELECT s FROM Sessoes s WHERE s.estado = :estado"),
    @NamedQuery(name = "Sessoes.findByUltimoLogin", query = "SELECT s FROM Sessoes s WHERE s.ultimoLogin = :ultimoLogin"),
    @NamedQuery(name = "Sessoes.findByDuracao", query = "SELECT s FROM Sessoes s WHERE s.duracao = :duracao")})
public class Sessoes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idSessoes")
    private Integer idSessoes;
    @Basic(optional = false)
    @NotNull
    @Column(name = "estado")
    private boolean estado;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ultimo_login")
    @Temporal(TemporalType.TIMESTAMP)
    private Date ultimoLogin;
    @Basic(optional = false)
    @NotNull
    @Column(name = "duracao")
    @Temporal(TemporalType.TIME)
    private Date duracao;
    @JoinColumn(name = "Contas_idContas", referencedColumnName = "idContas")
    @ManyToOne(optional = false)
    private Contas contasidContas;

    public Sessoes() {
    }

    public Sessoes(Integer idSessoes) {
        this.idSessoes = idSessoes;
    }

    public Sessoes(Integer idSessoes, boolean estado, Date ultimoLogin, Date duracao) {
        this.idSessoes = idSessoes;
        this.estado = estado;
        this.ultimoLogin = ultimoLogin;
        this.duracao = duracao;
    }

    public Integer getIdSessoes() {
        return idSessoes;
    }

    public void setIdSessoes(Integer idSessoes) {
        this.idSessoes = idSessoes;
    }

    public boolean getEstado() {
        return estado;
    }

    public void setEstado(boolean estado) {
        this.estado = estado;
    }

    public Date getUltimoLogin() {
        return ultimoLogin;
    }

    public void setUltimoLogin(Date ultimoLogin) {
        this.ultimoLogin = ultimoLogin;
    }

    public Date getDuracao() {
        return duracao;
    }

    public void setDuracao(Date duracao) {
        this.duracao = duracao;
    }

    public Contas getContasidContas() {
        return contasidContas;
    }

    public void setContasidContas(Contas contasidContas) {
        this.contasidContas = contasidContas;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSessoes != null ? idSessoes.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sessoes)) {
            return false;
        }
        Sessoes other = (Sessoes) object;
        if ((this.idSessoes == null && other.idSessoes != null) || (this.idSessoes != null && !this.idSessoes.equals(other.idSessoes))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Sessoes[ idSessoes=" + idSessoes + " ]";
    }
    
}
